package com.yanqu.road.server.channelserver.cmd.activity.tonbing;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.cross.activity.CrossActivityProto;
import com.yanqu.road.server.channelserver.manager.activity.tonbing.ChannelTonBingMgr;
import com.yanqu.road.server.channelserver.manager.activity.tonbing.activity.ChannelTonBingActivity;
import com.yanqu.road.server.cmd.CrossChannelCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.protocol.ChannelProtocol;

@Cmd(code = ChannelProtocol.N_TON_BING_SEND_CHAT, desc = "")
public class ChannelTonBingSendChatCmd extends CrossChannelCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        //todo 聊天准备放跨服
        CrossActivityProto.CrossActivityChatReqMsg reqMsg = CrossActivityProto.CrossActivityChatReqMsg.parseFrom(packet.getBytes());
        ChannelTonBingActivity activity = ChannelTonBingMgr.getActivity(reqMsg.getActivityId());
        activity.setLastReqTime(packet.getPlayerId());
        activity.sendChatByCmd(packet.getPlayerId(), reqMsg.toBuilder());
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
